import "package:flutter/material.dart";
import "../type.dart";

class DynamicHotCommentWidget extends StatelessWidget {
  final DynamicCommentItem hotComment; //动态热评
  const DynamicHotCommentWidget({super.key, required this.hotComment});
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.only(top: 8, bottom: 8),
      // 约束高度
      child: IntrinsicHeight(
        child: Row(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisSize: MainAxisSize.min,
          children: [
            Container(
              width: 2,
              margin: const EdgeInsets.only(right: 10),
              decoration: const BoxDecoration(
                color: Colors.black12,
              ),
            ),
            Container(
              margin: const EdgeInsets.only(right: 10),
              child: const Icon(
                Icons.mode_comment_outlined,
                size: 14,
                color: Colors.black54,
              ),
            ),
            Expanded(
              flex: 1,
              child: RichText(
                overflow: TextOverflow.ellipsis,
                maxLines: 2,
                text: TextSpan(
                  children: [
                    TextSpan(
                      text: "${hotComment.upName}：",
                      style: const TextStyle(
                        color: Colors.black87,
                        fontWeight: FontWeight.bold,
                        fontSize: 13.5,
                      ),
                    ),
                    TextSpan(
                      text: hotComment.content,
                      style: const TextStyle(
                        color: Colors.black87,
                        fontSize: 13.5,
                        height: 1.4,
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
